﻿using Elev.DataFactory;
using Elev.MoviesCenter.Utility;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Elev.MoviesCenter.Controls
{
    /// <summary>
    /// UC_MovieCard.xaml 的交互逻辑
    /// </summary>
    public partial class UC_MovieCard : UserControl
    {
        private TB_Videos video = null;

        public UC_MovieCard(TB_FilesInfo file)
        {
            InitializeComponent();
            video = LocalCenter.DBEntities.TB_Videos.FirstOrDefault(p => p.Guid == file.VideoGuid);
            if (Encoding.Default.GetByteCount(video.Name) > 18)
            {
                tbkMovieName.Text = Encoding.Default.GetString(Encoding.Default.GetBytes(video.Name), 0, 16) + "...";
            }
            //image.Source = new BitmapImage(new Uri(videoFile.FileName));

            //    bitImage = new BitmapImage();
            //    bitImage.BeginInit();
            //    bitImage.StreamSource = new FileStream(@".\Deadpool.jpg", FileMode.Open);
            //    bitImage.EndInit();
        }

        private void tbkMovieName_MouseDown(object sender, MouseButtonEventArgs e)
        {
        }
    }
}
